#ifndef EPOLLPOLLER
#define EPOLLPOLLER

#include <vector>
#include <sys/epoll.h>

class EventLoop;
class Channel;

class EPollPoller {

public:
    typedef std::vector<Channel*> ChannelList;


    EPollPoller(EventLoop* loop);

    void poll(int timeoutMs, ChannelList& activeChannelList);

    void updateChannel(Channel*);
    void removeChannel(Channel*);

private:
    void update(int op, Channel* channel);

    typedef std::vector<epoll_event> EventList;

    const static size_t kEventListInitLength = 16;
    
    EventLoop* loop_;
    int epollFd_;
    EventList events_;

};

#endif 